package com.love.cloud.auth.controller;

import com.love.cloud.auth.service.AuthenticationTokenService;
import com.love.cloud.auth.vo.AuthenticationTokenVo;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.validation.Valid;

/**
 * @author hongdongqu
 */
@RestController
@RequestMapping("/myAuth")
@Slf4j
public class AuthController {
    @Resource
    private AuthenticationTokenService authenticationTokenService;

    @PostMapping("/authenticationToken")
    public Object authenticationToken(@Valid @RequestBody AuthenticationTokenVo authenticationTokenVo){
        return authenticationTokenService.authenticationToken(authenticationTokenVo);
    }
    @GetMapping("/encryptedToken")
    public Object encryptedToken(HttpServletRequest request){
        return authenticationTokenService.encryptedToken(request);
    }
    @GetMapping("/infoByToken")
    public Object infoByToken(String token){
        return authenticationTokenService.infoByToken(token);
    }

}
